<% layout('/layouts/default.html', {title: '农机管理管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('农机管理管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('api:agricultural:machinery:agriculturalMachinery:edit')){ %>
					<a href="${ctx}/api/agricultural/machinery/agriculturalMachinery/form" class="btn btn-default btnTool" title="${text('新增农机管理')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${agriculturalMachinery}" action="${ctx}/api/agricultural/machinery/agriculturalMachinery/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('农机编号')}：</label>
					<div class="control-inline">
						<#form:input path="machineryNo" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('农机大类')}：</label>
					<div class="control-inline">
						<#form:input path="bigCategory" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('农机小类')}：</label>
					<div class="control-inline">
						<#form:input path="smallCategory" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('农机品目')}：</label>
					<div class="control-inline">
						<#form:input path="item" maxlength="30" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('终端类型')}：</label>
					<div class="control-inline">
						<#form:input path="terminalType" maxlength="30" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('出厂日期')}：</label>
					<div class="control-inline">
						<#form:input path="producteDate" readonly="true" maxlength="20" class="form-control Wdate-datetime"
							dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('status')}：</label>
					<div class="control-inline width-120">
						<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control isQuick"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('remarks')}：</label>
					<div class="control-inline">
						<#form:input path="remarks" maxlength="255" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('农机型号')}：</label>
					<div class="control-inline">
						<#form:input path="modelNo" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('发动机编号')}：</label>
					<div class="control-inline">
						<#form:input path="engineNumber" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('额定功率')}：</label>
					<div class="control-inline">
						<#form:input path="ratedPower" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('农机产品名称')}：</label>
					<div class="control-inline">
						<#form:input path="productName" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('农机产品型号')}：</label>
					<div class="control-inline">
						<#form:input path="productModel" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('出厂编号')}：</label>
					<div class="control-inline">
						<#form:input path="factoryNumber" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('机架号')}：</label>
					<div class="control-inline">
						<#form:input path="rackNumber" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('终端编号')}：</label>
					<div class="control-inline">
						<#form:input path="terminalNumber" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('终端企业名称')}：</label>
					<div class="control-inline">
						<#form:input path="manufacturerName" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('终端产品名称')}：</label>
					<div class="control-inline">
						<#form:input path="terminalProduct" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('省级编码')}：</label>
					<div class="control-inline">
						<#form:input path="province" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('市级编码')}：</label>
					<div class="control-inline">
						<#form:input path="municipal" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('区县级编码')}：</label>
					<div class="control-inline">
						<#form:input path="districtCounty" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('乡镇级编码')}：</label>
					<div class="control-inline">
						<#form:input path="township" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('马力范围')}：</label>
					<div class="control-inline">
						<#form:input path="horsepower" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('购机者地址')}：</label>
					<div class="control-inline">
						<#form:input path="addressBuyer" maxlength="255" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('归属合作社')}：</label>
					<div class="control-inline">
						<#form:input path="cooperative" maxlength="200" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('终端产品型号')}：</label>
					<div class="control-inline">
						<#form:input path="terminalModel" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('购机者类别')}：</label>
					<div class="control-inline">
						<#form:input path="buyerCategory" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('合作组织名称')}：</label>
					<div class="control-inline">
						<#form:input path="organizationName" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('法人')}：</label>
					<div class="control-inline">
						<#form:input path="legalPerson" maxlength="50" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('统一社会信用代码')}：</label>
					<div class="control-inline">
						<#form:input path="socialCreditCode" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("农机编号")}', name:'machineryNo', index:'a.machinery_no', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/api/agricultural/machinery/agriculturalMachinery/form?id='+row.id+'" class="btnList" data-title="${text("编辑农机管理")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("农机大类")}', name:'bigCategory', index:'a.big_category', width:150, align:"left"},
		{header:'${text("农机小类")}', name:'smallCategory', index:'a.small_category', width:150, align:"left"},
		{header:'${text("农机品目")}', name:'item', index:'a.item', width:150, align:"left"},
		{header:'${text("终端类型")}', name:'terminalType', index:'a.terminal_type', width:150, align:"left"},
		{header:'${text("出厂日期")}', name:'producteDate', index:'a.producte_date', width:150, align:"center"},
		{header:'${text("update_date")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
		{header:'${text("status")}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text("未知")}', true);
		}},
		{header:'${text("remarks")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
		{header:'${text("农机型号")}', name:'modelNo', index:'a.model_no', width:150, align:"left"},
		{header:'${text("发动机编号")}', name:'engineNumber', index:'a.engine_number', width:150, align:"left"},
		{header:'${text("额定功率")}', name:'ratedPower', index:'a.rated_power', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("农机产品名称")}', name:'productName', index:'a.product_name', width:150, align:"left"},
		{header:'${text("农机产品型号")}', name:'productModel', index:'a.product_model', width:150, align:"left"},
		{header:'${text("出厂编号")}', name:'factoryNumber', index:'a.factory_number', width:150, align:"left"},
		{header:'${text("机架号")}', name:'rackNumber', index:'a.rack_number', width:150, align:"left"},
		{header:'${text("终端编号")}', name:'terminalNumber', index:'a.terminal_number', width:150, align:"left"},
		{header:'${text("终端企业名称")}', name:'manufacturerName', index:'a.manufacturer_name', width:150, align:"left"},
		{header:'${text("终端产品名称")}', name:'terminalProduct', index:'a.terminal_product', width:150, align:"left"},
		{header:'${text("省级编码")}', name:'province', index:'a.province', width:150, align:"left"},
		{header:'${text("市级编码")}', name:'municipal', index:'a.municipal', width:150, align:"left"},
		{header:'${text("区县级编码")}', name:'districtCounty', index:'a.district_county', width:150, align:"left"},
		{header:'${text("乡镇级编码")}', name:'township', index:'a.township', width:150, align:"left"},
		{header:'${text("马力范围")}', name:'horsepower', index:'a.horsepower', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("购机者地址")}', name:'addressBuyer', index:'a.address_buyer', width:150, align:"left"},
		{header:'${text("归属合作社")}', name:'cooperative', index:'a.cooperative', width:150, align:"left"},
		{header:'${text("终端产品型号")}', name:'terminalModel', index:'a.terminal_model', width:150, align:"left"},
		{header:'${text("购机者类别")}', name:'buyerCategory', index:'a.buyer_category', width:150, align:"left"},
		{header:'${text("合作组织名称")}', name:'organizationName', index:'a.organization_name', width:150, align:"left"},
		{header:'${text("法人")}', name:'legalPerson', index:'a.legal_person', width:150, align:"left"},
		{header:'${text("统一社会信用代码")}', name:'socialCreditCode', index:'a.social_credit_code', width:150, align:"left"},
		{header:'${text("操作")}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('api:agricultural:machinery:agriculturalMachinery:edit')){ %>
				actions.push('<a href="${ctx}/api/agricultural/machinery/agriculturalMachinery/form?id='+row.id+'" class="btnList" title="${text("编辑农机管理")}"><i class="fa fa-pencil"></i></a>&nbsp;');
				if (row.status == Global.STATUS_NORMAL){
					actions.push('<a href="${ctx}/api/agricultural/machinery/agriculturalMachinery/disable?id='+row.id+'" class="btnList" title="${text("停用农机管理")}" data-confirm="${text("确认要停用该农机管理吗？")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
				} else if (row.status == Global.STATUS_DISABLE){
					actions.push('<a href="${ctx}/api/agricultural/machinery/agriculturalMachinery/enable?id='+row.id+'" class="btnList" title="${text("启用农机管理")}" data-confirm="${text("确认要启用该农机管理吗？")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
				}
				actions.push('<a href="${ctx}/api/agricultural/machinery/agriculturalMachinery/delete?id='+row.id+'" class="btnList" title="${text("删除农机管理")}" data-confirm="${text("确认要删除该农机管理吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>